package main.Q2001_2100;

public class Q2041_2050 {
    public static void main(String[] args) {
        System.out.println(3^1);
        System.out.println("Question2041：");
        System.out.println("Question2042：");
        System.out.println("Question2043：");
        System.out.println("Question2044：统计按位或能得到最大值的子集数目");
        int[] nums=new int[]{3,1};
        System.out.println(new Question2044().countMaxOrSubsets(nums));
        System.out.println("Question2045：");
        System.out.println("Question2046：");
        System.out.println("Question2047：");
        System.out.println("Question2048：");
        System.out.println("Question2049：");
        System.out.println("Question2050：");
    }
}

class Question2044 {
    public int countMaxOrSubsets(int[] nums) {
        int max = 0, count = 0;
        for (int i = 0; i < 1 << nums.length; i++) {
            int temp = 0;
            for (int j = 0; j < nums.length; j++) {
                if (((i >> j) & 1) == 1) {
                    temp |= nums[j];
                }
            }
            if (temp > max) {
                max = temp;
                count = 1;
            } else if (temp == max) {
                count++;
            }
        }
        return count;
    }
}